package exchange

import (
	"banzhuan/models"
	"banzhuan/rpc"
	"encoding/json"
)

func GetContracts() []models.Price {
	body:=rpc.HttpGet("","contracts","")
	//log.Println(string(body))
	contrancts:=[]models.Contracts{}
	json.Unmarshal(body,&contrancts)
	price_0:=models.Price{}
	price:=[]models.Price{}
	for i:=0;i<len(contrancts); i++ {
		if contrancts[i].Mnem!="RTETH" && contrancts[i].Mnem!="ZDCETH"&&contrancts[i].Mnem!="ZGCETH" {
			//log.Println(i,contrancts[i].Mnem)
			price_0.Symbol=contrancts[i].Mnem
			price_0.CoinName=contrancts[i].Asset
			price_0.BaseName=contrancts[i].Ccy
			price_0.TickDenom=contrancts[i].TickDenom
			price_0.LotDenom=contrancts[i].LotDenom
			price_0.LotNumer=contrancts[i].LotNumer
			price_0.MinLots=contrancts[i].MinLots
			price=append(price,price_0)
		}

		/*
				if contrancts[i].Mnem==symbol {
				return contrancts[i].TickDenom
			}
		*/

	}
	 //test,_:=json.Marshal(price)
	//  log.Println(string(test))
		return price
}
